package com.gejia.qixishare.service.impl;

import com.gejia.qixishare.entity.FileMd5RecordDO;
import com.gejia.qixishare.entity.UploadRecordDO;
import com.gejia.qixishare.mapper.UploadRecordMapper;
import com.gejia.qixishare.service.FileMd5RecordService;
import com.gejia.qixishare.service.UploadRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zy
 * @since 2020-08-22
 */
@Service
public class UploadRecordServiceImpl extends ServiceImpl<UploadRecordMapper, UploadRecordDO> implements UploadRecordService {

    @Autowired
    private FileMd5RecordService fileMd5RecordService;

    @Override
    public void saveUploadRecord(UploadRecordDO recordDO, String fileMd5) {
        this.save(recordDO);
        FileMd5RecordDO md5RecordDO = new FileMd5RecordDO();
        md5RecordDO.setFileOssPath(recordDO.getPicturePath());
        md5RecordDO.setMd5(fileMd5);
        fileMd5RecordService.save(md5RecordDO);
    }
}
